//
//  Util.h
//  drinkApp
//
//  Created by HexPang on 14/8/9.
//  Copyright (c) 2014年 CnbizMedia. All rights reserved.
//
#import "AppAPIClient.h"
#import <SDWebImageManager.h>
#import <SVProgressHUD.h>
#import <OpenUDID.h>
#import "AppData.h"
#import "BPush.h"
#import "sys/utsname.h"
#import <EGORefreshTableHeaderView.h>
#import "CommonHelper.h"
#import "PageControlScrollView.h"
#import "ArticleViewController.h"
#import "UIImageView+WebCache.h"
//#import "NSString+SBJSON.h"
//#import "UIViewController+MMDrawerController.h"
#import <BaiduSocialShare_Internal/BDSocialShareSDK_Internal.h>
#define INNER_NOTIFICATION @"INNER_NOTIFICATION"
//#define BAIDU_APP_KEY @"rMcNkRhUGTU7B9bfgQImCQY7"
//第三方appkey
#define BAIDU_APP_KEY @"Szn3HlldKZOiaScMev73fG6V"
#define QQ_APP_KEY @"100578511"
#define WEIXIN_APP_KEY @"wxcc46f8c63d1c23f5"
#define WEIXIN_App_Secret @"0f765f4b608d2da02a88b87d654b71de"

#define UIColorFromRGB2(r, g, b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1.0]
#define UIColorFromRGB(rgbValue) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]
#define SHOW_ALERT(title,msg) UIAlertView *alert = [[UIAlertView alloc]initWithTitle:title message:msg delegate:nil cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alert show];
#define SET_NAV_BAR     [[UINavigationBar appearance] setBarTintColor:[UIColor whiteColor]];[[UINavigationBar appearance] setTintColor:UIColorFromRGB(0xe60111)];NSDictionary *attributes=[NSDictionary dictionaryWithObjectsAndKeys:UIColorFromRGB(0xe60111),NSForegroundColorAttributeName,nil];[[UINavigationBar appearance] setTitleTextAttributes:attributes];
#define SET_TAB_BAR     [[UITabBar appearance] setSelectedImageTintColor: [UIColor redColor]];
#define SET_STA_BAR     [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault]
#define HIDE_NAV_BAR    [self.navigationController setNavigationBarHidden:YES animated:YES]
#define SHOW_NAV_BAR    [self.navigationController setNavigationBarHidden:NO animated:YES]
#define HIDE_STA_BAR    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]
#define SHOW_STA_BAR    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide]

#define DEVICE_OS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]

#define IFUserLogin [[NSUserDefaults standardUserDefaults] objectForKey:@"user"]
#define UserDefaults [NSUserDefaults standardUserDefaults]
#define APPDelegate [[UIApplication sharedApplication]delegate]

//RGB color macro with alpha
#define UIColorFromRGBWithAlpha(rgbValue,a) [UIColor \
colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 \
green:((float)((rgbValue & 0xFF00) >> 8))/255.0 \
blue:((float)(rgbValue & 0xFF))/255.0 alpha:a]


#define LOADING_TEXT @"载入中..."
#define LOADING_TEXT_SUCCESS @"载入完成"
#define LOADING_TEXT_ERROR @"载入失败..."
#define LOAD_COUNT 10

#define ARTICLE_LINE_SIZE 3
#define ARTICLE_CELL_HEIGHT 245.0f
#define ARTICLE_CELL_SPACE 10.0f
#define ARTICLE_TITLE_WIDE_WIDTH_SELECTED 210.0f
#define ARTICLE_TITLE_WIDE_WIDTH 55.0f
#define ARTICLE_TITLE_WIDE_HEIGHT 76.5f

#define ARTICLE_TITLE_FCOLOR_0 UIColorFromRGB(0xe5c97e)
#define ARTICLE_TITLE_FCOLOR_1 UIColorFromRGB(0x705457)
#define ARTICLE_TITLE_FCOLOR_2 UIColorFromRGB(0xdfd187)

#define ARTICLE_TITLE_BCOLOR_0 UIColorFromRGB(0xb33038)
#define ARTICLE_TITLE_BCOLOR_1 UIColorFromRGB(0xead584)
#define ARTICLE_TITLE_BCOLOR_2 UIColorFromRGB(0x65a6a0)

#define USER_COLLECTION_ROW_COUNT 4
#define USER_COLLECTION_CELL_HEIGHT 88.0f

#define ROUND_VALUE 5.0f

#define MAIN_TOP_VIEW_CHANGED @"MAIN_TOP_VIEW_CHANGED"

#define SHOW_LOADING_WITH_LOADING [SVProgressHUD showWithStatus:LOADING_TEXT maskType:SVProgressHUDMaskTypeGradient]
//#define SHOW_LOADING [SVProgressHUD showWithMaskType:SVProgressHUDMaskTypeClear]
#define SHOW_LOADING
#define HIDE_LOADING [SVProgressHUD dismiss];

//#define IS_IPHONE_6_PLUS [[[AppData platformString] rangeOfString:@" Plus"].location != NSNotFound]
#define DEVICE [AppData platformString]
